<template>
  <Header class="header fs-container" :class="isMobile ? 'mobile' : ''">
    <div class="left">
      <div v-if="isMobile ? (navOpened ? true : false) : true" :class="isMobile ? 'mobile-nav' : ''">
        <Nav @onSelect="() => (navOpened = false)" />
      </div>
    </div>

    <div class="link-li">
      <a v-for="(item, i) in links" :key="i" href="" >
        <img :src="importIcon(item.img)" />
      </a>
    </div>
  </Header>
</template>

<script lang="ts">
import Vue from 'vue'
import importIcon from '@/utils/import-icon'
import { Layout } from 'ant-design-vue'

const { Header } = Layout

export default Vue.extend({
  components: {
    Header
  },

  data() {
    return {
      navOpened: false,
      links: [
        {
          img: '/icons/link1.png',
          url: ''
        },
        {
          img: '/icons/link2.png',
          url: ''
        },
        {
          img: '/icons/link3.png',
          url: ''
        },
        {
          img: '/icons/link4.png',
          url: ''
        }
      ]
    }
  },

  computed: {
    isMobile() {
      return this.$accessor.isMobile
    }
  },
  methods:{
    importIcon,
  }
})
</script>

<style lang="less" scoped>
@import '../styles/variables';
@media screen and (max-width: 850px) {
  .link-li {
    a{
      margin-right: 6px !important;
    }
    img {
      width: 19px !important;
      height: 19px !important;
    }
  }
  .header{
    height: 50px !important;
  }
  .ant-layout-header{
    padding: 0 14px !important;
  }
}
.header {
  background: #fff;
  height: 84px;
  display: flex;
  justify-content: space-between;
  .left {
    display: flex;
    align-items: center;
    > a {
      width: 138px;
      margin-right: 170px;
      .logo {
        width: 100%;
      }
    }
  }

  .link-li {
    a{
      margin-right: 40px;
    }
    img {
      width: 40px;
      height: 40px;
    }
  }
}

.header.mobile {
  padding: 0 20px;
}
</style>
